package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class ReturnOperation implements IOPeration{
    @Override
    public void work(BookList bookList) {
        System.out.println("归还图书");
        Scanner scanner=new Scanner(System.in);
        String name=scanner.nextLine();
        int currentSize=bookList.getUsedsize();
        for (int i = 0; i <currentSize ; i++) {
            Book book=bookList.getBook(i);
            if (book.getName().equals(name)){
                book.setBorrowed(false);
                break;
            }
            else {
                System.out.println("这本书你还不了，因为书架原本没这本书" );
                break;
            }
        }
    }
}
